package servlet.context;

import jakarta.servlet.ServletContext;
/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-07-14
 * Time:23:19
 */
public class WebUtils{
    public static Integer visitCount(ServletContext context){
        Object count = context.getAttribute("visitCount");
        if(count == null){
            context.setAttribute("visitCount", 1);
            count = 1;
        } else {
            count = Integer.parseInt(count.toString()) + 1;
            context.setAttribute("visitCount", count);
        }
        return Integer.parseInt(count.toString());
    }
}
